package cn.itcast.bos.action.take_delivery;

import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionContext;

import cn.itcast.bos.domain.take_delivery.Order;
import cn.itcast.bos.service.take_delivery.OrderService;
import cn.itcast.bos.utils.BaseAction;
public class OrderAction extends BaseAction<Order> {
	@Autowired
	private OrderService orderService;
	
	@Action(value="order_findOrderByOrderNum",results={@Result(name="success",type="json")})
	public String findByOrderNum(){
		Order order = orderService.findByOrderNum(model.getOrderNum());
		Map<String,Object> map = new HashMap<String,Object>();
		if(order!=null){
			map.put("success", true);
			map.put("orderData", order);
		}else{
			map.put("success", false);
		}
		ActionContext.getContext().getValueStack().push(map);
		return SUCCESS;
	}
}
